
gdb_version := 7.2a
origin_src_dir := gdb-7.2

origin_src_tarball := gdb-$(gdb_version).tar.bz2
repo := http://ftpmirror.gnu.org/gdb/$(origin_src_tarball)

patches_files := $(wildcard patches/*.diff)

all:
	@echo NOTHING

build: $(BUILD_DIR)/Makefile
	@($(MAKE) $(MFLAGS) -C $(BUILD_DIR))

$(BUILD_DIR)/Makefile: sources
	@if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi
	@cd $(BUILD_DIR) && \
	../sources/configure --target=$(GCC_TOOLCHAIN_TARGET) --program-prefix=$(GCC_TOOLCHAIN_PROGRAM_PREFIX) --prefix=$(INSTALL_DIR)

.PHONY:init
init: sources
	@echo gdb init done

sources: $(origin_src_tarball)
	@echo extracting files...
	@tar xmf $(origin_src_tarball) && \
	mv $(origin_src_dir) sources
	@echo extract files done

$(origin_src_tarball):
	@wget -c -O $(origin_src_tarball) $(repo);

patch:
# NOT NEEDED. patch at mspgcc Makefile

unpatch:
# NOT NEEDED. unpatch at mspgcc Makefile

clean:
	if [ -f $(BUILD_DIR)/Makefile ]; then $(MAKE) $(MFLAGS) -C $(BUILD_DIR); fi

distclean:
	@$(RM) -r sources $(BUILD_DIR)

distdistclean: distclean
	@$(RM) $(origin_src_tarball)

install:
	@($(MAKE) $(MFLAGS) -C $(BUILD_DIR) install)

uninstall:
